<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../../../css/index.css" />
    <style>
        input::-webkit-input-placeholder{color: #BBBBBB;font-size: 14px;}
        input::-moz-placeholder{color: #BBBBBB;font-size: 14px;}

		.info-box{width: 100%;background: #FFFFFF;padding: 0 15px;box-sizing: border-box;}
		.info-box .info-one{align-items: center;height: 50px;}
        .info-box .info-one .text{width: 80px;flex-shrink: 0;}
		.info-box .info-one input{padding: 10px 0;line-height: 30px;box-sizing: border-box;color: #333333;}
		.info-box .info-one.goto{background: url(../../../image/main3/main3_goto.png) no-repeat right center;background-size:14px;padding-right: 16px;}
		.moren-btn{height: 50px;line-height: 50px;background: #FFFFFF;padding-left: 26px;box-sizing: border-box;background: url(../../../image/main2/sel_icon0.png) no-repeat left center;background-size:20px;}
 		.moren-btn.on{background: url(../../../image/main2/sel_icon1.png) no-repeat left center;background-size:20px;}

        /*协议*/
    	.moren{font-size: 13px;color:#333333;line-height: 30px;padding: 10px 15px;box-sizing: border-box;align-items: center;}
    	.moren .sel-box{width: 16px;height: 16px;background: url(../../../image/login/sel_0.png) no-repeat left center;background-size:16px;margin-right: 10px;}
    	.moren.on .sel-box{background: url(../../../image/login/sel_1.png) no-repeat left center;background-size:16px;}

    </style>
</head>
<body>
    <div id="vue">

        <div class="info-box">
        	<div class="info-one flex border-bottom">
        		<div class="text">持卡人</div>
        		<input class="flex1" type="text" maxlength="5" id="name" placeholder="请输入持卡人姓名" />
        	</div>
        	<div class="info-one flex border-bottom">
        		<div class="text">卡号</div>
        		<input class="flex1" type="tel" maxlength="20" id="cardNumber" placeholder="请输银行卡号"/>
        	</div>
        	<div class="info-one flex border-bottom">
        		<div class="text">银行</div>
        		<input class="flex1" maxlength="30" type="text" id="bankName" placeholder="请输入银行名称"/>
        	</div>
        	<div class="info-one flex">
        		<div class="text">开户行</div>
                <input class="flex1" maxlength="30" id="bankAddress" placeholder="请输入开户行"></input>
        	</div>
        </div>

        <div class="warp-btn" id="app-footer" tapmode onclick="upAddrData()">
            <div class="btn">提交</div>
        </div>

    </div>
<script type="text/javascript" src="../../../script/base.min.js" id="loadjs" data-js="L/h-tool"></script>
<script type="text/javascript">

	define(function (require, exports, module) {
        lanYun.setFooter('app-footer');

		var pageParam = api.pageParam;
	    var sdata = {};
	    lanYun.newVue('#vue',function(){});

        // 提交数据
	    upAddrData = function() {
	        sdata.name = $('#name').val();
	        sdata.cardNumber = $('#cardNumber').val();
	        sdata.bankName = $('#bankName').val();
            sdata.bankAddress = $('#bankAddress').val();

	        if(!sdata.name){
	            lanYun.toast('请填写持卡人姓名');
	            return;
	        }
	        if(!sdata.cardNumber) {
	            lanYun.toast('请填写银行卡号');
	            return;
	        }
            if(!TOOL.check.isBank(sdata.cardNumber)){
				lanYun.toast('请输入正确的银行卡号');
				return;
			}
	        if(!sdata.bankName){
	            lanYun.toast('请填写银行名称');
	            return;
	        }
	        if(!sdata.bankAddress){
	            lanYun.toast('请填写开户行');
	            return;
	        }
            var url = "company/BankCard/add";
            if(pageParam.type == 'store'){
                url = "store/BankCard/add";
            }
	        //console.log(JSON.stringify(sdata));
	        lanYun.post(url, sdata , function(ret) {
	            if(ret.errcode == 0){
	                lanYun.toast(ret.msg);
	                lanYun.setStorage('reshpage',1);
	                api.closeWin();
	            }else{
	                lanYun.toast(ret.msg);
	            }
	        },2);
	    };

	});
</script>
</body>
</html>
